package com.atguigu.lease.common.context;

import org.springframework.stereotype.Component;

@Component
public class LoginUserContext  {
    private static final ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();
    //工具当中的三个方法
    //1/存
    public static void setLoginUser(LoginUser loginUser){
        threadLocal.set(loginUser);
    }
    //2/取
    public static LoginUser getLoginUser(){
        return threadLocal.get();
    }
    //3/删
    public static void removeLoginUser(){
        threadLocal.remove();
    }







}
